
package com.xbongbong.saas.domain.dao;

import com.xbongbong.saas.domain.entity.ShareRuleEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * 共享权限规则DAO
 * @author leex
 */
@Mapper
@Repository
public interface ShareRuleDao {

    /**
     * 新增签到设置
     *
     * @param entity
     * @return
     */
    Integer insert(ShareRuleEntity entity);

    /**
     * 更新签到设置
     *
     * @param entity
     * @return
     */
    Integer update(ShareRuleEntity entity);

    /**
     * 根据ID删除
     *
     * @return
     */
    Integer deleteByKey(@Param("key") Long key, @Param("corpid") String corpid);
    /**
     * 批量删除
     *
     * @return
     */
    Integer deleteBatch(@Param("list") List<Long> list, @Param("corpid") String corpid);

    /**
     * 根据ID查询
     *
     * @return
     */
    ShareRuleEntity getByKey(@Param("key") Long key, @Param("corpid") String corpid);

    /**
     * 根据ID批量查询
     *
     * @return
     */
    List<ShareRuleEntity> getByIdIn(@Param("idIn") List<Long> idIn, @Param("corpid") String corpid);


    /**
     * 根据条件查询
     *
     * @return
     */
    List<ShareRuleEntity> findEntitys(@Param("param") Map<String, Object> param);

    /**
     * 根据条件统计
     *
     * @return
     */
    Integer getEntitysCount(@Param("param") Map<String, Object> param);

    /**
     * Description:查询授权用户
     *
     * @param corpid
     * @param formIdIn
     * @param roleIdIn
     * @param depIdIn
     * @param userIdIn
     * @return java.util.List<com.xbongbong.saas.domain.entity.ShareRuleEntity>
     * @throws
     * @author 魏荣杰
     * @date 2023/3/6 11:11
     * @since
     */
    List<ShareRuleEntity> findByAuthority(@Param("corpid") String corpid, @Param("formIdIn") List<Long> formIdIn, @Param("roleIdIn") List<String> roleIdIn, @Param("depIdIn") List<String> depIdIn, @Param("userIdIn") List<String> userIdIn);
}